Skip to content

feat(nav3): [Part 8] Define size and sensitive-data policies used when converting back stack entry properties into Sentry arguments - #6705

Open
0xadam-brown wants to merge 2 commits into
feat/nav3-serial-name-mappers-7from
feat/nav3-serial-name-mappers-8
Open

0xadam-brown wants to merge 2 commits into
feat/nav3-serial-name-mappers-7from
feat/nav3-serial-name-mappers-8

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Nav3 Serial Name Mappers)


📜 Description

PR provides infrastructure for serializing back stack entry properties as nav arguments, subject to size and structural limits. Applies Sentry's sensitive denylist to back stack properties, as described below.

(Note: the next PR will introduce the mapper that actually exposes this functionality to users; it and the updated sentry-docs are very explicit about the various issues surrounding sensitive data or PII that serializing entry properties can raise.)

💡 Motivation and Context

Automatically turning route properties into navigation arguments needs a consistent policy for data, payload limits, and fields that contain secrets. The built-in path should follow the same structural rules as custom mapper output.

addresses: JAVA-787 (link)

⚠️ Callouts

We filter sensitive data but not PII from back stack entry properties

This PR:

  1. continues to pass along custom mapper output as-is to the Sentry backend, but
  2. filters built-in mapper properties through Sentry's sensitive denylist.

Sentry's sensitive data policy applies to "key-value data" SDKs send to Sentry on host app's behalf, including "HTTP headers, cookies, and URL query params". This PR extends the rule to "key-value data" of serialized back stack entry properties.

Note that I have not tried to filter personal data or PII. A few reasons for that:

  • we don't do so for Nav2 (in fact, Nav2 doesn't filter sensitive data either, which is likely an oversight)
  • other SDKs don't do so
  • our coverage would be patchy / we'd have to figure out a policy for which keys we'd filter and which not
  • the number of false positives could be large
  • host apps are able to filter via a custom BackStackEntryMapper, or by applying their own filters directly to SerialNameAndProperties

Because we don't remove any personal data or PII, the sendDefaultPii and data-collection options don't apply.

In case you're curious, here's more info contrasting the behavior implemented here for Nav3 vs what we currently do for Nav2:

nav2 vs nav3 sensitive data and PII treatment

Chime in if you have thoughts.

We use an experimental kotlinx.serialization API

We need to run the app’s serializers while controlling where each value goes. We use an experimental kotlinx.serialization API to do so (AbstractEncoder), which increases the need for solid R8 tests (introduced in a later PR). AbstractEncoder lets us turn serializer output directly into Sentry arguments, filter sensitive keys before retaining their values, and stop encoding when an argument limit is exceeded. It also provides the common scalar-handling behavior that we would otherwise have to implement ourselves.

There are alternatives to AbstractEncoder, but they have their downsides:

  • Serialize to JSON first: creates an intermediate string or tree before Sentry can enforce its limits or filter sensitive values.
  • Use reflection: expensive performance-wise, and doesn't reliably reproduce serialization behavior such as @SerialName, custom serializers, and omitted properties.
  • Implement Encoder and CompositeEncoder directly: preserves the direct-encoding approach, but requires more implementation code. Those interfaces also carry kotlinx.serialization’s warning that third-party implementations are not stable for inheritance.

💚 How did you test it?

Nav3 release build and all 752 unit tests passed. Repository-wide make format api, Spotless checks, ABI validation, and Detekt passed. The 10 affected HttpUtils tests also passed.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Continue with PR 9: Add SerialNameAndProperties.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

#skip-changelog

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 546f3b8

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 546f3b8.

Main concerns: data sent to Sentry, public contract, reach.

Rules that block low also fired:

  • R4: a public API record changed: sentry/api/sentry.api

This label is a hint for reviewers, not an approval.

@sentry

sentry Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.65.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 20, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Nav3 Mappers 8] Define bounded property encoding feat(nav3): [Part 8] Define bounded property encoding Nov 20, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 8] Define bounded property encoding feat(nav3): [Part 8] Define size and sensitive-data policies used when converting back stack entry properties into Sentry arguments Nov 20, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review November 20, 2026 15:43
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners November 20, 2026 15:43
@0xadam-brown
0xadam-brown requested review from markushi and romtsn and removed request for a team November 20, 2026 15:43
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 20, 2026
@0xadam-brown 0xadam-brown added the sanity-check PR needs a lightweight review for obvious issues label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant